import {createRouter, createWebHashHistory} from 'vue-router'
//页面引入
const Home = () =>import("@/views/Home.vue")
const Cart = () =>import("@/views/Cart.vue")
const Detail = () =>import("@/views/Detail.vue")
const Login = () =>import("@/views/Login.vue")
const My = () => import("@/views/My.vue")
const Register = () =>import("@/views/Register.vue")
//路由配置
const routes = [
    {
        path:'/',
        redirect:'/home'
    },
    {
        path:'/home',
        name:"Home",
        component: Home
    },
    {
        path:'/cart',
        name:"Cart",
        component: Cart
    },
    {
        path:'/detail',
        name:"Detail",
        component: Detail
    },
    {
        path:'/login',
        name:"Login",
        component: Login
    },
    {
        path:'/my',
        name:"My",
        component: My
    },
    {
        path:'/register',
        name:"Register",
        component: Register
    }
]

//创建一个实例化路由
const router =createRouter({
    history:createWebHashHistory(),
    routes
})
export default router